﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

/// <summary>
/// Summary description for giohoa
/// </summary>
public class giohoa
{
    DBConnection db = new DBConnection();
	public giohoa()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public string laysohdx(string tendn,DateTime ngayxuat)
    {
        string sql = "insert into HDXuat(TenDN,NgayXuat) values(@tendn,@ngayxuat)";
        SqlParameter p1 = new SqlParameter("@tendn",tendn);
        SqlParameter p2 = new SqlParameter("@ngayxuat", ngayxuat);
        if (db.Get_data(sql, p1, p2) != null)
        {
            string sql1 = "select MAX(SoHDX) from HDXuat";
            object kq = db.LayDuLieu(sql1);
            return kq.ToString();
        }
        return "";
    }
    public void Insert_CTHDX(string SoHDX, string MaHoa,string sl,string dgx)
    {
        string sql = "insert into CTHDXuat(SoHDX,MaHoa,SlXuat,DgXuat) values(@SoHDX,@MaHoa,@SlXuat,@DgXuat)";
        SqlParameter p1 = new SqlParameter("@SoHDX", SoHDX);
        SqlParameter p2 = new SqlParameter("@MaHoa", MaHoa);
        SqlParameter p3 = new SqlParameter("@SlXuat", sl);
        SqlParameter p4 = new SqlParameter("@DgXuat", dgx);
        db.Get_data(sql,p1,p2,p3,p4);

    }

}